﻿@model trangbaocao.Models.StationsModel
<div class="container_12">       
    <div class="grid_12">            
        <div class="module"@* style="background:url(/Content/Body/Images/Body_Images/window10.jpg); width:100%;border-radius:5px;*@">
                <h2 align="right"><span><a href="@Url.Action("Index", "Stations")">Quay lại</a></span></h2>                       
                <div class="module-body">
                @using (Html.BeginForm("AddStations", "Stations", FormMethod.Post, new { id = "AddStations" }))
                {                      
                    <div align="center"><h3>THÊM MỚI NHÀ TRẠM</h3>
                        <div class="account" align="center"> 
                            <img src="@Url.Content("~/Content/Body/Images/Body_Images/Add_Station.png")" width="12%" />
                        </div>
                        
                    </div>
                    
                    if (TempData["msg"] != null)
                    {                            
                        <span class="notification n-error">@TempData["msg"]</span>
                    }  
                    <p></p>
                    <table>
                        <div style="width:50%; text-align:center; float:left; margin-bottom:5px">
                            <p align="center">
                                <label style="width:55%; text-align:left;">Mã nhà trạm:</label>
                                <div class="tendangnhap" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.ma_tram, new { @name = "ma_tram", @class = "input-medium" }) 
                                <font color="red">(*)</font>
                                <label style="width:60%; text-align:left;">
                                @Html.ValidationMessageFor(model => model.ma_tram)
                                </label>
                                </div>                                                                     
                            </p> 
                            <p align="center">
                                <label style="width:55%; text-align:left;">Tên nhà trạm:</label>
                                <div class="tendangnhap" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.name, new { @name = "name", @class = "input-medium" }) 
                                <font color="red">(*)</font>
                                <label style="width:60%; text-align:left;">
                                @Html.ValidationMessageFor(model => model.name)
                                </label>
                                </div>                                                                     
                            </p>  
                            <p align="center">
                                <label style="width:55%; text-align:left;">Địa chỉ:</label>
                                @Html.TextBoxFor(model => model.dia_chi, new { @name = "dia_chi", @class = "input-medium" })                       
                            </p>                          
                            <p align="center">
                                <label style="width:55%; text-align:left;">Trung tâm:</label>
                                @if (Model.trung_tam_id != null)
                                { 
                                    @Html.DropDownListFor(x => x.main_stations_id, Model.trung_tam_id)                     
                                }
                            </p> 
                            <p align="center" style="padding-left:11px; width:100%">
                                <label style="width:60.8%; text-align:left;">Xã/Phường:</label>
                                        @*@Html.DropDownListFor(x => x.stations_id, Enumerable.Empty<SelectListItem>(),"---Chọn nhà trạm---")*@
                                         @if (Model.khuvucs_id != null)
                                         {                                  
                                             @Html.DropDownListFor(x => x.village_id, Model.khuvucs_id)
                                         }
                                        <font color="red">(*)</font>
                                <label style="width:60%; text-align:left;">
                                @Html.ValidationMessageFor(model => model.village_id)
                                </label>                    
                            </p> 
                             
                            <p align="center">
                                <label style="width:55%; text-align:left;">Người quản lý:</label>
                                @Html.TextBoxFor(model => model.nguoi_quan_ly, new { @name = "nguoi_quan_ly", @class = "input-medium" })
                            </p>
                            <p align="center">
                                <label style="width:55%; text-align:left;">Số điện thoại:</label>
                                @Html.TextBoxFor(model => model.so_dien_thoai, new { @name = "so_dien_thoai", @class = "input-medium" })
                            </p>                    
                            @*<p align="center"> 
                                <label style="width:55%; text-align:left;">Trạm Node B:</label>
                                <select name="tram_node_b">
                                    <option value="0" selected="selected">Không</option>
                                    <option value="1">Có</option>
                                </select>
                            </p> *@
                            <p align="center">
                                <label style="width:55%; text-align:left;">Ghi chú:</label>
                                @Html.TextBoxFor(model => model.ghi_chu, new { @name = "ghi_chu", @class = "input-medium" })
                                <label>@Html.ValidationMessageFor(model => model.ghi_chu)</label>
                            </p> 
                            
                        </div> <!--end div table-->
                        <div style="width:50%; text-align:center; float:left; margin-bottom:5px"> 
                            <div class="date_select" align="center">
                                <label style="width:55%; text-align:left;">Ngày xây dựng:</label>
                                    <p align="center" style="width:55%; text-align:left;">
                                        @Html.TextBoxFor(model => model.ngay_xay_dung, new { @name = "ngay_xay_dung", @class = "date" })
                                    </p>
                            </div> 
                            <div class="date_select" align="center">
                                <label style="width:55%; text-align:left;">Ngày sử dụng:</label>
                                    <p align="center" style="width:55%; text-align:left;">
                                        @Html.TextBoxFor(model => model.ngay_su_dung, new { @name = "ngay_su_dung", @class = "date" })
                                    </p>
                            </div>   
                            <p align="center">
                                <label style="width:55%; text-align:left;">Tọa độ:</label>
                                @Html.TextBoxFor(model => model.toa_do, new { @name = "toa_do", @class = "input-medium" })
                            </p>
                            <p align="center">
                                <label style="width:55%; text-align:left;">Cột:</label>
                                <select name="cot">
                                    <option value="TD18">TD18</option>
                                    <option value="DC20">DC20</option>
                                    <option value="NN20">NN20</option>
                                </select>
                            </p>
                            <p align="center">
                                <label style="width:55%; text-align:left;">CSHT (Cơ sở hạ tầng):</label>
                                <select name="csht">
                                    <option value="VNPT">VNPT</option>
                                    <option value="VMS">VMS</option>
                                    <option value="VNM">VNM</option>
                                    <option value="VTN">VTN</option>
                                    <option value="VIETTEL">VIETTEL</option>
                                    <option value="KHÁC">KHÁC</option>
                                </select>                                 
                            </p>
                            <p align="center">
                                <label style="width:55%; text-align:left;">Số cấp phép CSHT:</label>
                                @Html.TextBoxFor(model => model.cap_phep, new { @name = "cap_phep", @class = "input-medium" })
                            </p>
                            <div class="date_select" align="center">
                                <label style="width:55%; text-align:left;">Ngày cấp phép CSHT:</label>
                                    <p align="center" style="width:55%; text-align:left;">
                                        @Html.TextBoxFor(model => model.ngay_cap_phep, new { @name = "ngay_cap_phep", @class = "date" })
                                    </p>
                            </div>
                            <p align="center">
                                <label style="width:55%; text-align:left;">Loại CSHT:</label>
                                @Html.TextBoxFor(model => model.loai_csht, new { @name = "loai_csht", @class = "input-medium" })
                            </p>
                            <p align="center">
                                <label style="width:55%; text-align:left;">Kiểu CSHT:</label>
                                <select name="kieu_csht">
                                    <option value="SHELTER">SHELTER</option>
                                    <option value="OUTDOOR">OUTDOOR</option>
                                    <option value="INDOOR">INDOOR</option>
                                </select>                                
                            </p>                 
                                               
                        </div> <!--end div table-->
                    </table>
                     <div class="button" align="center">
                        <p style="width:25%; text-align:center">
                        <input class="submit-green" type="submit" value="Thêm"/> 
                        <input class="submit-gray" type="reset" value="Hủy" />
                        @*<input class="submit-gray" type="button"  onclick="location.href='@Url.Action("Index", "User")'" value="Quay lại" />*@
                        </p>
                    </div>
                }
                    
                </div> <!-- End .module-body -->

        </div>  <!-- End .module -->
        <div style="clear:both;"></div>
    </div> <!-- End .grid_12 --> 
    <div style="clear:both;"></div>
</div> <!-- End .container_12 -->

<script type="text/javascript">
    $(document).ready(function () {
        $("#date").datepicker({ dateFormat: 'dd/mm/yy' });
    });
</script>
<script type="text/javascript">
    $("#main_stations_id").change(function () {
        $.ajax({
            type: "POST",
            url: '@Url.Action("getKhuvucsJson", "Stations")',
            data: { MainStationId: $("#main_stations_id > option:selected").attr("value"), Order: "ten_kv" },
            success: function (data) {
                var items = [];
                items.push("<option>---Chọn khu vực---</option>");
                $.each(data, function () {
                    items.push("<option value=" + this.Value + ">" + this.Text + "</option>");
                });
                $("#village_id").html(items.join(' '));
            }
        })
    });
</script>